package com.kodandroid.commons;

public class Item extends Attribute {
	private Price price = null;
	private String name;
	private double discount;
	private Type type;
	
	public Item (int itemId, double price, String name, Type type) {
		this.id = itemId;
		this.price = new Price(price);
		this.name = name;
		this.type = type;
		this.discount = 0;
	}
	
	//call this for all instances where the price will be displayed
	public String toString() {
		return "$" + price.toString();
	}
	
	//do not call this for anything other than calculations
	public double getPrice() {
		return price.getPrice();
	}
	
	public void applyDiscount(double discount) {
		price.setPrice(price.getPrice()*discount);
		this.discount = discount;
	}
	
	public double getDiscount() {
		return discount;
	}
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public Type getType() {
		return type;
	}
	
	public void setType(Type type) {
		this.type = type;
	}
}
